<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class Test::Unit::TestCase - test-unit: Ruby Standard Library Documentation</title>


<script src="../../js/navigation.js" defer></script>
<script src="../../js/search.js" defer></script>
<script src="../../js/search_index.js" defer></script>
<script src="../../js/searcher.js" defer></script>
<script src="../../js/darkfish.js" defer></script>

<script src="../../js/jquery-3.2.0.min.js"></script>

<script src="../../js/vue.min.js"></script>
<script src="../../js/js.cookie.min.js"></script>

<link href="../../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../../css/rdoc.css" rel="stylesheet">
<link href="../../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../../";
  var index_rel_prefix = "../../";
  var darkModeCsseHref = "../../css/rdoc-dm.css"
  var defaultModeCssHref = "../../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../../table_of_contents.html#pages">Pages</a>
    <a href="../../table_of_contents.html#classes">Classes</a>
    <a href="../../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link"><a href="../../Object.html">Object</a>
</div>

        
<div id="includes-section" class="nav-section">
  <h3>Included Modules</h3>

  <ul class="link-list">
    <li><a class="include" href="Attribute.html">Test::Unit::Attribute</a>
    <li><a class="include" href="Fixture.html">Test::Unit::Fixture</a>
    <li><a class="include" href="ExceptionHandler.html">Test::Unit::ExceptionHandler</a>
    <li><a class="include" href="ErrorHandler.html">Test::Unit::ErrorHandler</a>
    <li><a class="include" href="FailureHandler.html">Test::Unit::FailureHandler</a>
    <li><a class="include" href="TestCasePendingSupport.html">Test::Unit::TestCasePendingSupport</a>
    <li><a class="include" href="TestCaseOmissionSupport.html">Test::Unit::TestCaseOmissionSupport</a>
    <li><a class="include" href="TestCaseNotificationSupport.html">Test::Unit::TestCaseNotificationSupport</a>
    <li><a class="include" href="Priority.html">Test::Unit::Priority</a>
    <li><a class="include" href="Data.html">Test::Unit::Data</a>
    <li><a class="include" href="Assertions.html">Test::Unit::Assertions</a>
    <li><a class="include" href="Util/BacktraceFilter.html">Test::Unit::Util::BacktraceFilter</a>
    <li><a class="include" href="Util/Output.html">Test::Unit::Util::Output</a>
  </ul>
</div>

        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-add_method_location">::add_method_location</a>
    <li ><a href="#method-c-description">::description</a>
    <li ><a href="#method-c-find_locations">::find_locations</a>
    <li ><a href="#method-c-method_locations">::method_locations</a>
    <li ><a href="#method-c-new">::new</a>
    <li ><a href="#method-c-ractor">::ractor</a>
    <li ><a href="#method-c-shutdown">::shutdown</a>
    <li ><a href="#method-c-startup">::startup</a>
    <li ><a href="#method-c-sub_test_case">::sub_test_case</a>
    <li ><a href="#method-c-sub_test_case_class">::sub_test_case_class</a>
    <li ><a href="#method-c-suite">::suite</a>
    <li ><a href="#method-c-target_method_locations">::target_method_locations</a>
    <li ><a href="#method-c-test">::test</a>
    <li ><a href="#method-c-test_defined-3F">::test_defined?</a>
    <li ><a href="#method-c-test_order">::test_order</a>
    <li ><a href="#method-c-test_order-3D">::test_order=</a>
    <li ><a href="#method-i-3D-3D">#==</a>
    <li ><a href="#method-i-add_assertion">#add_assertion</a>
    <li ><a href="#method-i-add_pass">#add_pass</a>
    <li ><a href="#method-i-cleanup">#cleanup</a>
    <li ><a href="#method-i-current_result">#current_result</a>
    <li ><a href="#method-i-data">#data</a>
    <li ><a href="#method-i-data_label">#data_label</a>
    <li ><a href="#method-i-default_test">#default_test</a>
    <li ><a href="#method-i-description">#description</a>
    <li ><a href="#method-i-elapsed_time">#elapsed_time</a>
    <li ><a href="#method-i-handle_exception">#handle_exception</a>
    <li ><a href="#method-i-interrupted-3F">#interrupted?</a>
    <li ><a href="#method-i-local_name">#local_name</a>
    <li ><a href="#method-i-name">#name</a>
    <li ><a href="#method-i-passed-3F">#passed?</a>
    <li ><a href="#method-i-problem_occurred">#problem_occurred</a>
    <li ><a href="#method-i-run">#run</a>
    <li ><a href="#method-i-run_test">#run_test</a>
    <li ><a href="#method-i-setup">#setup</a>
    <li ><a href="#method-i-size">#size</a>
    <li ><a href="#method-i-start_time">#start_time</a>
    <li ><a href="#method-i-teardown">#teardown</a>
    <li ><a href="#method-i-to_s">#to_s</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-Test::Unit::TestCase">
    <h1 id="class-Test::Unit::TestCase" class="class">
      class Test::Unit::TestCase
    </h1>

    <section class="description">
    
<p>Ties everything together. If you subclass and add your own test methods, it takes care of making them into tests and wrapping those tests into a suite. It also does the nitty-gritty of actually running an individual test and collecting its results into a <a href="TestResult.html"><code>Test::Unit::TestResult</code></a> object.</p>

<p>You can run two hooks before/after a <a href="TestCase.html"><code>TestCase</code></a> run.</p>

<p>Example:</p>

<pre>class TestMyClass &lt; Test::Unit::TestCase
  class &lt;&lt; self
    def startup
      ...
    end

    def shutdown
      ...
    end
  end

  def setup
    ...
  end

  def cleanup
    ...
  end

  def teardown
    ...
  end

  def test_my_method1
    ...
  end

  def test_my_method2
    ...
  end
end</pre>

<p>Here is a call order:</p>
<ol><li>
<p>startup</p>
</li><li>
<p>setup</p>
</li><li>
<p>test_my_method1</p>
</li><li>
<p>cleanup</p>
</li><li>
<p>teardown</p>
</li><li>
<p>setup</p>
</li><li>
<p>test_my_method2</p>
</li><li>
<p>cleanup</p>
</li><li>
<p>teardown</p>
</li><li>
<p>shutdown</p>
</li></ol>

<p>You can set an attribute to each test.</p>

<p>Example:</p>

<pre>class TestMyClass &lt; Test::Unit::TestCase
  attribute :speed, :fast
  def test_my_fast_method
    # You can get the attribute via `self[]`
    self[:speed] # =&gt; :fast
    ...
  end

  attribute :speed, :slow
  def test_my_slow_method
    self[:speed] # =&gt; :slow
    ...
  end
end</pre>

    </section>

      <section id="5Buntitled-5D" class="documentation-section">



        <section class="attribute-method-details" class="method-section">
        <header>
        <h3>Attributes</h3>
        </header>

          <div id="attribute-i-method_name" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">method_name</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
            </section>


                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-description" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">description</span><span
                                class="method-args">(value, target=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Describes a test.</p>

<p>The following example associates “register a normal user” description with “test_register” test.</p>

<pre>description &quot;register a normal user&quot;
def test_register
  ...
end</pre>

                              <div class="method-source-code" id="description-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 349</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">description</span>(<span class="ruby-identifier">value</span>, <span class="ruby-identifier">target</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">targets</span> = [<span class="ruby-identifier">target</span>].<span class="ruby-identifier">compact</span>
  <span class="ruby-identifier">attribute</span>(<span class="ruby-value">:description</span>, <span class="ruby-identifier">value</span>, {}, <span class="ruby-operator">*</span><span class="ruby-identifier">targets</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-find_locations" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">find_locations</span><span
                                class="method-args">(query)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="find_locations-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 441</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">find_locations</span>(<span class="ruby-identifier">query</span>)
  <span class="ruby-identifier">query_path</span> = <span class="ruby-identifier">query</span>[<span class="ruby-value">:path</span>]
  <span class="ruby-identifier">query_line</span> = <span class="ruby-identifier">query</span>[<span class="ruby-value">:line</span>]
  <span class="ruby-identifier">query_method_name</span> = <span class="ruby-identifier">query</span>[<span class="ruby-value">:method_name</span>]

  <span class="ruby-identifier">available_locations</span> = <span class="ruby-identifier">target_method_locations</span>(<span class="ruby-identifier">query_path</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">query_line</span>
    <span class="ruby-identifier">available_locations</span> = <span class="ruby-identifier">available_locations</span>.<span class="ruby-identifier">sort_by</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">location</span><span class="ruby-operator">|</span>
      <span class="ruby-operator">-</span><span class="ruby-identifier">location</span>[<span class="ruby-value">:line</span>]
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">available_location</span> = <span class="ruby-identifier">available_locations</span>.<span class="ruby-identifier">find</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">location</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">query_line</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-identifier">location</span>[<span class="ruby-value">:line</span>]
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">return</span> [] <span class="ruby-keyword">if</span> <span class="ruby-identifier">available_location</span>.<span class="ruby-identifier">nil?</span>
    <span class="ruby-keyword">return</span> [] <span class="ruby-keyword">if</span> <span class="ruby-identifier">available_location</span>[<span class="ruby-value">:test_case</span>] <span class="ruby-operator">!=</span> <span class="ruby-keyword">self</span>
    <span class="ruby-identifier">available_locations</span> = [<span class="ruby-identifier">available_location</span>]
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">query_method_name</span>
    <span class="ruby-identifier">available_location</span> = <span class="ruby-identifier">available_locations</span>.<span class="ruby-identifier">find</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">location</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">location</span>[<span class="ruby-value">:test_case</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword">self</span> <span class="ruby-keyword">and</span>
        <span class="ruby-identifier">query_method_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">location</span>[<span class="ruby-value">:method_name</span>]
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">return</span> [] <span class="ruby-keyword">if</span> <span class="ruby-identifier">available_location</span>.<span class="ruby-identifier">nil?</span>
    <span class="ruby-identifier">available_locations</span> = [<span class="ruby-identifier">available_location</span>]
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">available_locations</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-new" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">new</span><span
                                class="method-args">(test_method_name)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Creates a new instance of the fixture for running the test represented by test_method_name.</p>

                              <div class="method-source-code" id="new-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 528</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">test_method_name</span>)
  <span class="ruby-ivar">@method_name</span> = <span class="ruby-identifier">test_method_name</span>
  <span class="ruby-ivar">@internal_data</span> = <span class="ruby-constant">InternalData</span>.<span class="ruby-identifier">new</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-ractor" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">ractor</span><span
                                class="method-args">(options={})</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Declares that the following test uses Ractor.</p>

<p>Tests that use Ractor are executed at the end. Because multi Ractor mode is enabled in the current process and it’s not disabled even when only one Ractor is running after running a test that uses Ractor on Ruby 3.0. It will be solved in the future.</p>

<p>This is implemented by setting the ‘:ractor` attribute of the test to `true`.</p>

<p>@param options [Hash] See {Attribute::ClassMethods#attribute}</p>

<pre>for details.</pre>

<p>@return [void]</p>

<p>@example Declares that test_do_something_with_ractor uses Ractor</p>

<pre class="ruby"><span class="ruby-identifier">ractor</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">test_do_something_with_ractor</span>
  <span class="ruby-constant">Ractor</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword">do</span>
    <span class="ruby-comment"># ...</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>
</pre>

<p>@since 3.4.6</p>

                              <div class="method-source-code" id="ractor-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 380</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">ractor</span>(<span class="ruby-identifier">options</span>={})
  <span class="ruby-identifier">attribute</span>(<span class="ruby-value">:ractor</span>, <span class="ruby-keyword">true</span>, <span class="ruby-identifier">options</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-shutdown" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">shutdown</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Called after every test case runs. Can be used to tear down fixture information used in test case scope.</p>

<p>Here is an example test case:</p>

<pre>class TestMyClass &lt; Test::Unit::TestCase
  class &lt;&lt; self
    def shutdown
      ...
    end
  end

  def teardown
    ...
  end

  def test_my_class1
    ...
  end

  def test_my_class2
    ...
  end
end</pre>

<p>Here is a call order:</p>
<ul><li>
<p>test_my_class1 (or test_my_class2)</p>
</li><li>
<p>teardown</p>
</li><li>
<p>test_my_class2 (or test_my_class1)</p>
</li><li>
<p>teardown</p>
</li><li>
<p>shutdown</p>
</li></ul>

<p>Note that you should not assume test order. Tests should be worked in any order.</p>

                              <div class="method-source-code" id="shutdown-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 259</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">shutdown</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-startup" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">startup</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Called before every test case runs. Can be used to set up fixture information used in test case scope.</p>

<p>Here is an example test case:</p>

<pre>class TestMyClass &lt; Test::Unit::TestCase
  class &lt;&lt; self
    def startup
      ...
    end
  end

  def setup
    ...
  end

  def test_my_class1
    ...
  end

  def test_my_class2
    ...
  end
end</pre>

<p>Here is a call order:</p>
<ul><li>
<p>startup</p>
</li><li>
<p>setup</p>
</li><li>
<p>test_my_class1 (or test_my_class2)</p>
</li><li>
<p>setup</p>
</li><li>
<p>test_my_class2 (or test_my_class1)</p>
</li></ul>

<p>Note that you should not assume test order. Tests should be worked in any order.</p>

                              <div class="method-source-code" id="startup-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 221</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">startup</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-sub_test_case" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">sub_test_case</span><span
                                class="method-args">(name, &amp;block)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Defines a sub test case.</p>

<p>This is a syntax sugar. The both of the following codes are the same in meaning:</p>

<p>Standard:</p>

<pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">TestParent</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">Test</span><span class="ruby-operator">::</span><span class="ruby-constant">Unit</span><span class="ruby-operator">::</span><span class="ruby-constant">TestCase</span>
  <span class="ruby-keyword">class</span> <span class="ruby-constant">TestChild</span> <span class="ruby-operator">&lt;</span> <span class="ruby-keyword">self</span>
    <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">test_in_child</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>
</pre>

<p>Syntax sugar:</p>

<pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">TestParent</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">Test</span><span class="ruby-operator">::</span><span class="ruby-constant">Unit</span><span class="ruby-operator">::</span><span class="ruby-constant">TestCase</span>
  <span class="ruby-identifier">sub_test_case</span>(<span class="ruby-string">&quot;TestChild&quot;</span>) <span class="ruby-keyword">do</span>
    <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">test_in_child</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>
</pre>

<p>The difference of them are the following:</p>
<ul><li>
<p><a href="../../Test.html"><code>Test</code></a> case created by {sub_test_case} is an anonymous class. So you can’t refer the test case by name.</p>
</li><li>
<p>The class name of class style must follow constant naming rule in Ruby. But the name of test case created by {sub_test_case} doesn’t need to follow the rule. For example, you can use a space in name such as “child test”.</p>
</li></ul>

<p>@param name [String] The name of newly created sub test case. @yield</p>

<pre>The block is evaluated under the newly created sub test
case class context.</pre>

<p>@return [Test::Unit::TestCase] Created sub test case class.</p>

                              <div class="method-source-code" id="sub_test_case-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 421</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">sub_test_case</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
  <span class="ruby-identifier">sub_test_case</span> = <span class="ruby-identifier">sub_test_case_class</span>(<span class="ruby-identifier">name</span>)
  <span class="ruby-identifier">sub_test_case</span>.<span class="ruby-identifier">class_eval</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
  <span class="ruby-identifier">sub_test_case</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-suite" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">suite</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Rolls up all of the test* methods in the fixture into one suite, creating a new instance of the fixture for each method.</p>

                              <div class="method-source-code" id="suite-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 180</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">suite</span>
  <span class="ruby-identifier">suite_creator</span> = <span class="ruby-constant">TestSuiteCreator</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</span>)
  <span class="ruby-identifier">suite_creator</span>.<span class="ruby-identifier">create</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-test" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">test</span><span
                                class="method-args">(*test_description_or_targets, &amp;block)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Defines a test in declarative syntax or marks following method as a test method.</p>

<p>In declarative syntax usage, the following two test definitions are the almost same:</p>

<pre>description &quot;register user&quot;
def test_register_user
  ...
end

test &quot;register user&quot; do
  ...
end</pre>

<p>In test method mark usage, the “my_test_method” is treated as a test method:</p>

<pre>test
def my_test_method
  assert_equal(&quot;call me&quot;, ...)
end</pre>

                              <div class="method-source-code" id="test-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 312</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">test</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">test_description_or_targets</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">block_given?</span>
    <span class="ruby-identifier">test_description</span> = <span class="ruby-identifier">test_description_or_targets</span>.<span class="ruby-identifier">first</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">test_description</span>.<span class="ruby-identifier">nil?</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">&quot;test description is missing&quot;</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">n_arguments</span> = <span class="ruby-identifier">test_description_or_targets</span>.<span class="ruby-identifier">size</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">n_arguments</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span>
      <span class="ruby-identifier">message</span> = <span class="ruby-node">&quot;wrong number of arguments (#{n_arguments} for 1)&quot;</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-identifier">message</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">method_name</span> = <span class="ruby-node">&quot;test: #{test_description}&quot;</span>
    <span class="ruby-identifier">description</span>(<span class="ruby-identifier">test_description</span>, <span class="ruby-identifier">method_name</span>)
    <span class="ruby-identifier">attribute</span>(<span class="ruby-value">:test</span>, <span class="ruby-keyword">true</span>, {}, <span class="ruby-identifier">method_name</span>)
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">block</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:source_location</span>)
      <span class="ruby-identifier">attribute</span>(<span class="ruby-value">:source_location</span>, <span class="ruby-identifier">block</span>.<span class="ruby-identifier">source_location</span>, {}, <span class="ruby-identifier">method_name</span>)
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">define_method</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">targets</span> = <span class="ruby-identifier">test_description_or_targets</span>
    <span class="ruby-identifier">attribute</span>(<span class="ruby-value">:test</span>, <span class="ruby-keyword">true</span>, {}, <span class="ruby-operator">*</span><span class="ruby-identifier">targets</span>)
    <span class="ruby-identifier">targets</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">target</span><span class="ruby-operator">|</span>
      <span class="ruby-constant">AutoRunnerLoader</span>.<span class="ruby-identifier">check</span>(<span class="ruby-keyword">self</span>, <span class="ruby-identifier">target</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-test_defined-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">test_defined?</span><span
                                class="method-args">(query)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Checks whether a test that is matched the query is defined.</p>

<p>@option query [String] :path (nil)</p>

<pre>the path where a test is defined in.</pre>

<p>@option query [Numeric] :line (nil)</p>

<pre>the line number where a test is defined at.</pre>

<p>@option query [String] :method_name (nil)</p>

<pre>the method name for a test.</pre>

                              <div class="method-source-code" id="test_defined-3F-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 436</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">test_defined?</span>(<span class="ruby-identifier">query</span>)
  <span class="ruby-identifier">locations</span> = <span class="ruby-identifier">find_locations</span>(<span class="ruby-identifier">query</span>)
  <span class="ruby-keyword">not</span> <span class="ruby-identifier">locations</span>.<span class="ruby-identifier">empty?</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-test_order" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">test_order</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the current test order. This returns ‘:alphabetic` by default.</p>

                              <div class="method-source-code" id="test_order-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 266</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">test_order</span>
  <span class="ruby-identifier">ancestors</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ancestor</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">order</span> = <span class="ruby-identifier">@@test_orders</span>[<span class="ruby-identifier">ancestor</span>]
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">order</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">order</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-constant">AVAILABLE_ORDERS</span>.<span class="ruby-identifier">first</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-test_order-3D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">test_order=</span><span
                                class="method-args">(order)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Sets the current test order.</p>

<p>Here are the available <em>order</em>:</p>

<p>:alphabetic : Default. Tests are sorted in alphabetic order.</p>

<p>:random : Tests are sorted in random order.</p>

<p>:defined : Tests are sorted in defined order.</p>

                              <div class="method-source-code" id="test_order-3D-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 286</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">test_order=</span>(<span class="ruby-identifier">order</span>)
  <span class="ruby-identifier">@@test_orders</span>[<span class="ruby-keyword">self</span>] = <span class="ruby-identifier">order</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="private-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Private Class Methods</h3>
                </header>

                  <div id="method-c-add_method_location" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add_method_location</span><span
                                class="method-args">(location)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>@private</p>

                              <div class="method-source-code" id="add_method_location-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 482</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_method_location</span>(<span class="ruby-identifier">location</span>)
  <span class="ruby-identifier">@@method_location_mutex</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">method_locations</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">location</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-method_locations" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">method_locations</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>@private</p>

                              <div class="method-source-code" id="method_locations-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 477</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">method_locations</span>
  <span class="ruby-identifier">@@method_locations</span>[<span class="ruby-keyword">self</span>] <span class="ruby-operator">||=</span> []
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-sub_test_case_class" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">sub_test_case_class</span><span
                                class="method-args">(name)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>@private</p>

                              <div class="method-source-code" id="sub_test_case_class-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 513</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">sub_test_case_class</span>(<span class="ruby-identifier">name</span>)
  <span class="ruby-identifier">parent_test_case</span> = <span class="ruby-keyword">self</span>
  <span class="ruby-constant">Class</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</span>) <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">singleton_class</span> = <span class="ruby-keyword">class</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword">self</span>; <span class="ruby-keyword">self</span>; <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">singleton_class</span>.<span class="ruby-identifier">__send__</span>(<span class="ruby-value">:define_method</span>, <span class="ruby-value">:name</span>) <span class="ruby-keyword">do</span>
      [<span class="ruby-identifier">parent_test_case</span>.<span class="ruby-identifier">name</span>, <span class="ruby-identifier">name</span>].<span class="ruby-identifier">compact</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;::&quot;</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-target_method_locations" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">target_method_locations</span><span
                                class="method-args">(path)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>@private</p>

                              <div class="method-source-code" id="target_method_locations-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 489</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">target_method_locations</span>(<span class="ruby-identifier">path</span>)
  <span class="ruby-identifier">@@method_location_mutex</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword">do</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">nil?</span>
      <span class="ruby-identifier">self_location</span> = <span class="ruby-identifier">method_locations</span>.<span class="ruby-identifier">first</span>
      <span class="ruby-identifier">path</span> = <span class="ruby-identifier">self_location</span>[<span class="ruby-value">:path</span>] <span class="ruby-keyword">if</span> <span class="ruby-identifier">self_location</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">return</span> [] <span class="ruby-keyword">if</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">nil?</span>

    <span class="ruby-identifier">target_locations</span> = []
    <span class="ruby-identifier">@@method_locations</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">test_case</span>, <span class="ruby-identifier">locations</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">locations</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">location</span><span class="ruby-operator">|</span>
        <span class="ruby-identifier">absolete_path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">path</span>)
        <span class="ruby-identifier">location_path</span> = <span class="ruby-identifier">location</span>[<span class="ruby-value">:path</span>]
        <span class="ruby-identifier">location_basename</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">location_path</span>)
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">location_path</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">absolete_path</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">location_basename</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">path</span>
          <span class="ruby-identifier">target_locations</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">location</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-value">:test_case</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">test_case</span>)
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">target_locations</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-3D-3D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">==</span><span
                                class="method-args">(other)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>It’s handy to be able to compare <a href="TestCase.html"><code>TestCase</code></a> instances.</p>

                              <div class="method-source-code" id="3D-3D-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 794</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">==</span>(<span class="ruby-identifier">other</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@method_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">method_name</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">data_label</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">data_label</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">class</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-add_pass" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add_pass</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Notify that the test is passed. Normally, it is not needed because <a href="TestCase.html#method-i-run"><code>run</code></a> calls it automatically. If you want to override <a href="TestCase.html#method-i-run"><code>run</code></a>, it is not a good idea. Please contact test-unit developers. We will help you without your custom <a href="TestCase.html#method-i-run"><code>run</code></a>. For example, we may add a new hook in <a href="TestCase.html#method-i-run"><code>run</code></a>.</p>

<p>This is a public API for developers who extend test-unit.</p>

<p>@return [void]</p>

                              <div class="method-source-code" id="add_pass-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 843</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_pass</span>
  <span class="ruby-identifier">current_result</span>.<span class="ruby-identifier">add_pass</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-cleanup" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">cleanup</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Called after every test method runs but the test method isn’t marked as ‘passed’. Can be used to clean up and/or verify tested condition. e.g. Can be used to verify mock.</p>

<p>You can add additional cleanup tasks by the following code:</p>

<pre>class TestMyClass &lt; Test::Unit::TestCase
  def cleanup
    ...
  end

  cleanup
  def my_cleanup1
    ...
  end

  cleanup do
    ... # cleanup callback1
  end

  cleanup
  def my_cleanup2
    ...
  end

  cleanup do
    ... # cleanup callback2
  end

  def test_my_class
    ...
  end
end</pre>

<p>Here is a call order:</p>
<ul><li>
<p>test_my_class</p>
</li><li>
<p>cleanup callback2</p>
</li><li>
<p>my_cleanup2</p>
</li><li>
<p>cleanup callback1</p>
</li><li>
<p>my_cleanup1</p>
</li><li>
<p>cleanup</p>
</li></ul>

                              <div class="method-source-code" id="cleanup-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 691</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">cleanup</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-data" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">data</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns test data for the test. If the test isn’t associated with any test data, it returns ‘nil`.</p>

                              <div class="method-source-code" id="data-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 756</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">data</span>
  <span class="ruby-ivar">@internal_data</span>.<span class="ruby-identifier">test_data</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-data_label" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">data_label</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a label of test data for the test. If the test isn’t associated with any test data, it returns ‘nil`.</p>

                              <div class="method-source-code" id="data_label-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 750</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">data_label</span>
  <span class="ruby-ivar">@internal_data</span>.<span class="ruby-identifier">test_data_label</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-default_test" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">default_test</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="default_test-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 739</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">default_test</span>
  <span class="ruby-identifier">flunk</span>(<span class="ruby-string">&quot;No tests were specified&quot;</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-description" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">description</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a description for the test. A description will be associated by <a href="TestCase.html#method-c-test"><code>Test::Unit::TestCase.test</code></a> or <a href="TestCase.html#method-c-description"><code>Test::Unit::TestCase.description</code></a>.</p>

<p>Returns a name for the test for no description test.</p>

                              <div class="method-source-code" id="description-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 784</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">description</span>
  <span class="ruby-keyword">self</span>[<span class="ruby-value">:description</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">name</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-elapsed_time" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">elapsed_time</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns elapsed time for the test was ran.</p>

                              <div class="method-source-code" id="elapsed_time-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 807</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">elapsed_time</span>
  <span class="ruby-ivar">@internal_data</span>.<span class="ruby-identifier">elapsed_time</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-interrupted-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">interrupted?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns whether the test is interrupted.</p>

                              <div class="method-source-code" id="interrupted-3F-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 812</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">interrupted?</span>
  <span class="ruby-ivar">@internal_data</span>.<span class="ruby-identifier">interrupted?</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-local_name" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">local_name</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a human-readable name for the specific test that this instance of <a href="TestCase.html"><code>TestCase</code></a> represents.</p>

<p>‘#local_name` doesn’t include class name. ‘#name` includes class name.</p>

                              <div class="method-source-code" id="local_name-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 771</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">local_name</span>
  <span class="ruby-keyword">if</span> <span class="ruby-ivar">@internal_data</span>.<span class="ruby-identifier">have_test_data?</span>
    <span class="ruby-node">&quot;#{@method_name}[#{data_label}]&quot;</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-ivar">@method_name</span>.<span class="ruby-identifier">to_s</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-name" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">name</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a human-readable name for the specific test that this instance of <a href="TestCase.html"><code>TestCase</code></a> represents.</p>

                              <div class="method-source-code" id="name-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 762</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">name</span>
  <span class="ruby-node">&quot;#{local_name}(#{self.class.name})&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-passed-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">passed?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns whether this individual test passed or not. Primarily for use in teardown so that artifacts can be left behind if the test fails.</p>

                              <div class="method-source-code" id="passed-3F-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 819</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">passed?</span>
  <span class="ruby-ivar">@internal_data</span>.<span class="ruby-identifier">passed?</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-problem_occurred" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">problem_occurred</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Notify that a problem is occurred in the test. It means that the test is a failed test. If any failed tests exist in test suites, the test process exits with failure exit status.</p>

<p>This is a public API for developers who extend test-unit.</p>

<p>@return [void]</p>

                              <div class="method-source-code" id="problem_occurred-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 830</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">problem_occurred</span>
  <span class="ruby-ivar">@internal_data</span>.<span class="ruby-identifier">problem_occurred</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-run" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">run</span><span
                                class="method-args">(result) { |STARTED, name| ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Runs the individual test method represented by this instance of the fixture, collecting statistics, failures and errors in result.</p>

                              <div class="method-source-code" id="run-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 555</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">run</span>(<span class="ruby-identifier">result</span>)
  <span class="ruby-keyword">begin</span>
    <span class="ruby-ivar">@_result</span> = <span class="ruby-identifier">result</span>
    <span class="ruby-ivar">@internal_data</span>.<span class="ruby-identifier">test_started</span>
    <span class="ruby-keyword">yield</span>(<span class="ruby-constant">STARTED</span>, <span class="ruby-identifier">name</span>)
    <span class="ruby-keyword">yield</span>(<span class="ruby-constant">STARTED_OBJECT</span>, <span class="ruby-keyword">self</span>)
    <span class="ruby-identifier">processed_exception_in_setup</span> = <span class="ruby-keyword">false</span>
    <span class="ruby-keyword">begin</span>
      <span class="ruby-identifier">catch</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">tag</span><span class="ruby-operator">|</span>
        <span class="ruby-identifier">run_setup</span> <span class="ruby-keyword">do</span>
          <span class="ruby-keyword">begin</span>
            <span class="ruby-identifier">run_test</span>
            <span class="ruby-identifier">run_cleanup</span>
            <span class="ruby-identifier">add_pass</span>
          <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Exception</span>
            <span class="ruby-ivar">@internal_data</span>.<span class="ruby-identifier">interrupted</span>
            <span class="ruby-keyword">unless</span> <span class="ruby-identifier">handle_exception</span>(<span class="ruby-identifier">$!</span>)
              <span class="ruby-identifier">processed_exception_in_setup</span> = <span class="ruby-keyword">true</span>
              <span class="ruby-identifier">raise</span>
            <span class="ruby-keyword">end</span>
            <span class="ruby-identifier">throw</span>(<span class="ruby-identifier">tag</span>)
          <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Exception</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">processed_exception_in_setup</span>
        <span class="ruby-identifier">raise</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-ivar">@internal_data</span>.<span class="ruby-identifier">interrupted</span>
        <span class="ruby-identifier">raise</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">handle_exception</span>(<span class="ruby-identifier">$!</span>)
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">ensure</span>
      <span class="ruby-keyword">begin</span>
        <span class="ruby-identifier">run_teardown</span>
      <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Exception</span>
        <span class="ruby-identifier">raise</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">handle_exception</span>(<span class="ruby-identifier">$!</span>)
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-ivar">@internal_data</span>.<span class="ruby-identifier">test_finished</span>
    <span class="ruby-identifier">result</span>.<span class="ruby-identifier">add_run</span>
    <span class="ruby-keyword">yield</span>(<span class="ruby-constant">FINISHED</span>, <span class="ruby-identifier">name</span>)
    <span class="ruby-keyword">yield</span>(<span class="ruby-constant">FINISHED_OBJECT</span>, <span class="ruby-keyword">self</span>)
  <span class="ruby-keyword">ensure</span>
    <span class="ruby-comment"># @_result = nil # For test-spec&#39;s after_all :&lt;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-setup" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">setup</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Called before every test method runs. Can be used to set up fixture information.</p>

<p>You can add additional setup tasks by the following code:</p>

<pre>class TestMyClass &lt; Test::Unit::TestCase
  def setup
    ...
  end

  setup
  def my_setup1
    ...
  end

  setup do
    ... # setup callback1
  end

  setup
  def my_setup2
    ...
  end

  setup do
    ... # setup callback2
  end

  def test_my_class
    ...
  end
end</pre>

<p>Here is a call order:</p>
<ul><li>
<p>setup</p>
</li><li>
<p>my_setup1</p>
</li><li>
<p>setup callback1</p>
</li><li>
<p>my_setup2</p>
</li><li>
<p>setup callback2</p>
</li><li>
<p>test_my_class</p>
</li></ul>

                              <div class="method-source-code" id="setup-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 644</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">setup</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-size" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">size</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="size-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 743</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">size</span>
  <span class="ruby-value">1</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-start_time" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">start_time</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a Time at the test was started.</p>

                              <div class="method-source-code" id="start_time-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 802</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">start_time</span>
  <span class="ruby-ivar">@internal_data</span>.<span class="ruby-identifier">start_time</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-teardown" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">teardown</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Called after every test method runs. Can be used to tear down fixture information.</p>

<p>You can add additional teardown tasks by the following code:</p>

<pre>class TestMyClass &lt; Test::Unit::TestCase
  def teardown
    ...
  end

  teardown
  def my_teardown1
    ...
  end

  teardown do
    ... # teardown callback1
  end

  teardown
  def my_teardown2
    ...
  end

  teardown do
    ... # teardown callback2
  end

  def test_my_class
    ...
  end
end</pre>

<p>Here is a call order:</p>
<ul><li>
<p>test_my_class</p>
</li><li>
<p>teardown callback2</p>
</li><li>
<p>my_teardown2</p>
</li><li>
<p>teardown callback1</p>
</li><li>
<p>my_teardown1</p>
</li><li>
<p>teardown</p>
</li></ul>

                              <div class="method-source-code" id="teardown-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 736</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">teardown</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-to_s" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">to_s</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Overridden to return <a href="TestCase.html#method-i-name"><code>name</code></a>.</p>

                              <div class="method-source-code" id="to_s-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 789</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_s</span>
  <span class="ruby-identifier">name</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="private-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Private Instance Methods</h3>
                </header>

                  <div id="method-i-add_assertion" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add_assertion</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="add_assertion-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 887</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_assertion</span>
  <span class="ruby-identifier">current_result</span>.<span class="ruby-identifier">add_assertion</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-current_result" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">current_result</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="current_result-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 848</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">current_result</span>
  <span class="ruby-ivar">@_result</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-handle_exception" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">handle_exception</span><span
                                class="method-args">(exception)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="handle_exception-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 875</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">handle_exception</span>(<span class="ruby-identifier">exception</span>)
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">exception_handlers</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">handler</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">handler</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:call</span>)
      <span class="ruby-identifier">handled</span> = <span class="ruby-identifier">handler</span>.<span class="ruby-identifier">call</span>(<span class="ruby-keyword">self</span>, <span class="ruby-identifier">exception</span>)
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">handled</span> = <span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">handler</span>, <span class="ruby-identifier">exception</span>)
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">handled</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">false</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-run_test" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">run_test</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="run_test-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/testcase.rb, line 852</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">run_test</span>
  <span class="ruby-identifier">signature</span> = <span class="ruby-node">&quot;#{self.class}\##{@method_name}&quot;</span>
  <span class="ruby-identifier">redefined_info</span> = <span class="ruby-keyword">self</span>[<span class="ruby-value">:redefined</span>]
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">redefined_info</span>
    <span class="ruby-identifier">notify</span>(<span class="ruby-node">&quot;&lt;#{signature}&gt; was redefined&quot;</span>,
           <span class="ruby-value">:backtrace</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">redefined_info</span>[<span class="ruby-value">:backtrace</span>])
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">if</span> <span class="ruby-keyword">self</span>[<span class="ruby-value">:ractor</span>] <span class="ruby-keyword">and</span> <span class="ruby-keyword">not</span> <span class="ruby-keyword">defined?</span>(<span class="ruby-operator">::</span><span class="ruby-constant">Ractor</span>)
    <span class="ruby-identifier">omit</span>(<span class="ruby-node">&quot;&lt;#{signature}&gt; requires Ractor&quot;</span>)
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">if</span> <span class="ruby-ivar">@internal_data</span>.<span class="ruby-identifier">have_test_data?</span>
    <span class="ruby-identifier">test_method</span> = <span class="ruby-identifier">method</span>(<span class="ruby-ivar">@method_name</span>)
    <span class="ruby-identifier">arity</span> = <span class="ruby-identifier">test_method</span>.<span class="ruby-identifier">arity</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">arity</span>.<span class="ruby-identifier">zero?</span>
      <span class="ruby-identifier">__send__</span>(<span class="ruby-ivar">@method_name</span>)
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">__send__</span>(<span class="ruby-ivar">@method_name</span>, <span class="ruby-ivar">@internal_data</span>.<span class="ruby-identifier">test_data</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">__send__</span>(<span class="ruby-ivar">@method_name</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is provided by <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>. </p><p><a href="https://jamesbritt.bandcamp.com/">Hack your world.  Feed your head.  Live curious</a>.</p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

